package thread.pool.core.util;


public class HttpResult {

    private Object data;
    private int code;
    private String msg;
    private String timestamp;
    private Boolean ok;
    public static int FAIL_CODE = 500;
    public static int success_code = 200;

    public Boolean getOk() {
        return this.ok;
    }

    public void setOk(Boolean ok) {
        this.ok = ok;
    }

    public boolean isOk() {
        return this.code == 200;
    }

    public Object getData() {
        return this.data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public int getCode() {
        return this.code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return this.msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getTimestamp() {
        return this.timestamp;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }

    public HttpResult(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public HttpResult() {
    }

    public static  HttpResult ok(Object data) {
        HttpResult tHttpResult = new HttpResult();
        tHttpResult.setCode(success_code);
        tHttpResult.setData(data);
        return tHttpResult;
    }

    public static HttpResult ok() {
        HttpResult tHttpResult = new HttpResult();
        tHttpResult.setCode(success_code);
        tHttpResult.setData(null);
        return tHttpResult;
    }

    public String toString() {
        return "HttpResult{data=" + this.data + ", code=" + this.code + ", msg='" + this.msg + '\'' + ", timestamp='" + this.timestamp + '\'' + ", ok=" + this.ok + '}';
    }

}
